<%_
// 本表是否有配置 字典数据 的字段
const _hasDict = fieldList.some((fieldItem) => fieldItem.dict != '')
// 本表 配置的字典标识数组（去重过的）
const _uniDictList = [...new Set(fieldList.filter((fieldItem) => fieldItem.dict != '').map((item) => item.dict))]
// 本表是否有配置 搜索 的字段
const _hasQuery = fieldList.some((fieldItem) => fieldItem.query != '')
// 主键字段数据
const pkField =  fieldList.find((item) => item.key === 'PRI') || {}
_%>
<template>
  <view class="content">
    <%_ if (_hasQuery) { _%>
    <!-- #ifdef APP-PLUS || H5 -->
    <roc-navbar :title="pageTitle" rightIcon="search" @rightClick="searchShow = true"></roc-navbar>
    <!-- #endif -->
    <!-- #ifndef APP-PLUS || H5 -->
    <roc-navbar :title="pageTitle"></roc-navbar>
    <!-- #endif -->
    <%_ } else { _%>
    <roc-navbar :title="pageTitle"></roc-navbar>
    <%_ } _%>
    <!-- 内容 -->
    <view class="u-p-20">
      <!-- 表格展示 -->
      <uni-table stripe :loading="loading" v-show="$store.state.app.listViewType === 'table'">
        <uni-tr>
          <%_ // 循环字段 _%>
          <%_ for (const field of fieldList) { _%>
          <%_ // 单位处理 _%>
          <%_ const label = field.unit ? `${field.label}（${field.unit}）` : field.label _%>
          <%_ // 已配置列表显示 _%>
          <%_ if (field.list) { _%>
          <uni-th align="center"><%= label %></uni-th>
          <%_ } _%>
          <%_ } _%>
          <%_ // 是否有 子表 _%>
          <%_ if (subTable) { _%>
          <uni-th align="center">操作</uni-th>
          <%_ } else { _%>
          <%_ // 是否有 编辑 删除 功能 _%>
          <%_ if (hasEdit || hasDel) { _%>
          <uni-th align="center" v-if="hasPermi(['<%= editPermisstion %>', '<%= delPermisstion %>'])">操作</uni-th>
          <%_ } _%>
          <%_ } _%>
        </uni-tr>
        <uni-tr v-for="row in tableList" :key="row.id">
          <%_ // 循环字段 _%>
          <%_ for (const field of fieldList) { _%>
          <%_ // 单位处理 _%>
          <%_ const label = field.unit ? `${field.label}（${field.unit}）` : field.label _%>
          <%_ if (field.list) { _%>
          <%_ // 已配置列表显示 _%>
          <%_ if (field.display === 'input') { _%>
          <%_ // 文本框 _%>
          <uni-td align="center">{{ row.<%= field.name %> }}</uni-td>
          <%_ } else if (field.display === 'inputNumber') { _%>
          <%_ // 数字框 _%>
          <uni-td align="center">{{ row.<%= field.name %> }}</uni-td>
          <%_ } else if (field.display === 'textarea') { _%>
          <%_ // 文本域 _%>
          <uni-td align="center">{{ row.<%= field.name %> }}</uni-td>
          <%_ } else if (field.display === 'select') { _%>
          <%_ // 下拉框 _%>
          <%_ if (field.dict) { _%>
          <uni-td align="center">
            <roc-dict-tag :options="dictType['<%= field.dict %>']" :value="row.<%= field.name %>"></roc-dict-tag>
          </uni-td>
          <%_ } else { _%>
          <uni-td align="center">{{ row.<%= field.name %> }}</uni-td>
          <%_ } _%>
          <%_ } else if (field.display === 'radio') { _%>
          <%_ // 单选框 _%>
          <%_ if (field.dict) { _%>
          <uni-td align="center">
            <roc-dict-tag :options="dictType['<%= field.dict %>']" :value="row.<%= field.name %>"></roc-dict-tag>
          </uni-td>
          <%_ } else { _%>
          <uni-td align="center">{{ row.<%= field.name %> }}</uni-td>
          <%_ } _%>
          <%_ } else if (field.display === 'checkbox') { _%>
          <%_ // 复选框 _%>
          <%_ if (field.dict) { _%>
          <uni-td align="center">
            <roc-dict-tag :options="dictType['<%= field.dict %>']" :value="row.<%= field.name %>"></roc-dict-tag>
          </uni-td>
          <%_ } else { _%>
          <uni-td align="center">{{ row.<%= field.name %> }}</uni-td>
          <%_ } _%>
          <%_ } else if (field.display === 'date') { _%>
          <%_ // 日期 _%>
          <uni-td align="center">{{ row.<%= field.name %> }}</uni-td>
          <%_ } else if (field.display === 'datetime') { _%>
          <%_ // 日期时间 _%>
          <uni-td align="center">{{ row.<%= field.name %> }}</uni-td>
          <%_ } else if (field.display === 'imageUpload') { _%>
          <%_ // 图片上传 _%>
          <uni-td align="center">
            <u-album
              style="display: inline-block; margin-top: 4px;"
              :urls="row.<%= field.name %>"
              :maxCount="1"
              :singleSize="40"
              :multipleSize="40"
            ></u-album>
          </uni-td>
          <%_ } else if (field.display === 'fileUpload') { _%>
          <%_ // 文件上传 不显示 _%>
          <%_ } else if (field.display === 'editor') { _%>
          <%_ // 富文本 不显示 _%>
          <%_ } else { %>
          <%_ // 其他 不显示 _%>
          <%_ } _%>
          <%_ } _%>
          <%_ } _%>
          <%_ // 是否有 子表 _%>
          <%_ if(subTable) { _%>
          <uni-td align="center" class="table-btn">
            <text class="text-success" @click="handleDetail(row)">明细</text>
            <%_ // 是否有 编辑 删除 功能 _%>
            <%_ if(hasEdit || hasDel) { _%>
            <text class="text-primary" @click="handleEdit(row)" v-if="hasPermi(['<%= editPermisstion %>'])">修改</text>
            <text class="text-error" @click="handleDelete(row)" v-if="hasPermi(['<%= delPermisstion %>'])">删除</text>
            <%_ } _%>
          </uni-td>
          <%_ } else { _%>
          <%_ // 是否有 编辑 删除 功能 _%>
          <%_ if(hasEdit || hasDel) { _%>
          <uni-td align="center" class="table-btn" v-if="hasPermi(['<%= editPermisstion %>', '<%= delPermisstion %>'])">
            <text class="text-primary" @click="handleEdit(row)" v-if="hasPermi(['<%= editPermisstion %>'])">修改</text>
            <text class="text-error" @click="handleDelete(row)" v-if="hasPermi(['<%= delPermisstion %>'])">删除</text>
          </uni-td>
          <%_ } _%>
          <%_ } _%>
        </uni-tr>
      </uni-table>
      <%_ // 列表展示（需要自行提取显示字段!!!） _%>
      <!-- 列表展示（需要自行提取显示字段!!!） -->
      <view class="roc-list" v-show="$store.state.app.listViewType == 'list'">
        <view class="list-item u-p-20" v-for="(row, index) in tableList" :key="row.id">
          <view class="top">
            <view class="area1">
              <text>{{ row.id }}</text>
            </view>
            <view class="area2">{{ row.id }}</view>
          </view>
          <view class="center">
            <view class="area3">id：{{ row.id }}</view>
          </view>
          <view class="bottom">
            <view class="area4">创建时间：{{ row.create_time }}</view>
            <view class="area4">修改时间：{{ row.update_time }}</view>
          </view>
          <%_ // 是否有 子表 _%>
          <%_if(subTable) { _%>
          <view class="btn-box">
            <u-button type="success" size="mini" @click="handleDetail(row)">明细</u-button>
            <%_ // 是否有 编辑 删除 功能 _%>
            <%_ if(hasEdit || hasDel) { _%>
            <u-button type="primary" size="mini" @click="handleEdit(row)" v-if="hasPermi(['<%= editPermisstion %>'])">修改</u-button>
            <u-button type="error" size="mini" @click="handleDelete(row)" v-if="hasPermi(['<%= delPermisstion %>'])">删除</u-button>
            <%_ } _%>
          </view>
          <%_ } else { _%>
          <%_ // 是否有 编辑 删除 功能 _%>
          <%_ if(hasEdit || hasDel) { _%>
          <view class="btn-box" v-if="hasPermi(['<%= editPermisstion %>', '<%= delPermisstion %>'])">
            <u-button type="primary" size="mini" @click="handleEdit(row)" v-if="hasPermi(['<%= editPermisstion %>'])">修改</u-button>
            <u-button type="error" size="mini" @click="handleDelete(row)" v-if="hasPermi(['<%= delPermisstion %>'])">删除</u-button>
          </view>
          <%_ } _%>
          <%_ } _%>
        </view>
      </view>
      <!-- 分页 -->
      <uni-pagination v-if="total > 0" class="u-m-t-20" :total="total" v-model="queryParams.page" :pageSize="queryParams.limit" @change="getList" />
      <!-- 内容为空 -->
      <u-empty marginTop="16vh" :show="!total" mode="data" text="暂无数据~"></u-empty>
    </view>
    <!-- 右下角按钮操作 -->
    <view class="side-btn-box">
      <%_ // 是否有搜索 _%>
      <%_ if(_hasQuery) { _%>
      <!-- #ifndef APP-PLUS || H5 -->
      <view class="side-btn" @click="searchShow = true">
        <roc-icon-plus name="search" color="#fff" size="20"></roc-icon-plus>
      </view>
      <!-- #endif -->
      <%_ } _%>
      <view class="side-btn" @click="$store.commit('app/LIST_SWITCH_VIEW')">
        <roc-icon-plus name="arrow-right-arrow-left" color="#fff" size="20"></roc-icon-plus>
      </view>
      <%_ // 是否有 添加  功能 _%>
      <%_ if(hasAdd) { _%>
      <view class="side-btn" v-if="hasPermi(['<%= addPermisstion %>'])" @click="handleAdd">
        <roc-icon-plus name="add" color="#fff" size="22"></roc-icon-plus>
      </view>
      <%_ } _%>
    </view>
    <!-- 回到顶部 -->
    <u-back-top
      :scroll-top="scrollTop"
      :top="50"
      :bottom="60"
      :iconStyle="{ color: '#fff', fontSize: '20px', fontWeight: 'bold' }"
      :customStyle="{ backgroundColor: 'rgba(60, 156, 255, 0.8)' }"
    ></u-back-top>
    <!-- 模态框 -->
    <u-modal :show="modal.show" :title="modal.title" :content="modal.content" :showCancelButton="true" @confirm="handleModalConfirm" @cancel="modal.show = false"></u-modal>
    <%_ if(_hasQuery) { _%>
    <!-- 查询弹框 -->
    <u-popup class="search-popup" :show="searchShow" @close="searchShow = false" mode="bottom" round="10" :closeable="true" :closeOnClickOverlay="false">
      <view class="title">搜索</view>
      <scroll-view class="popup-cont" scroll-y="true">
        <view class="u-p-20">
          <!-- 查询条件 -->
          <u-form ref="formRef" :model="queryParams" labelPosition="top" label-width="100%">
            <%_ // 循环字段 _%>
            <%_ for (const field of fieldList) { _%>
            <%_ // 判断字段是否设置搜索查询 _%>
            <%_ if (field.query) { _%>
            <%_ // 已配置列表显示 _%>
            <%_ if (field.display === 'input') { _%>
            <%_ // 文本框 _%>
            <u-form-item label="<%= field.label %>" prop="<%= field.name %>">
              <u-input v-model="queryParams.<%= field.name %>" placeholder="<%= field.label %>"></u-input>
            </u-form-item>
            <%_ } else if (field.display === 'inputNumber') { _%>
            <%_ // 数字框 _%>
            <u-form-item label="<%= field.label %>" prop="<%= field.name %>">
              <u-input v-model="queryParams.<%= field.name %>" placeholder="<%= field.label %>" type="number"></u-input>
            </u-form-item>
            <%_ } else if (field.display === 'textarea') { _%>
            <%_ // 文本域 _%>
            <u-form-item label="<%= field.label %>" prop="<%= field.name %>">
              <u-textarea v-model="queryParams.<%= field.name %>" placeholder="<%= field.label %>"></u-textarea>
            </u-form-item>
            <%_ } else if (field.display === 'select') { _%>
            <%_ // 下拉框 _%>
            <u-form-item label="<%= field.label %>" prop="<%= field.name %>">
              <%_ if(field.dict) { _%>
              <zxz-uni-data-select v-model="queryParams.<%= field.name %>" :localdata="[{value: 1, text: '请手动写入选项 或者 选择字典生成'}]" placeholder="<%= field.label %>"></zxz-uni-data-select>
              <%_ } else { _%>
              <zxz-uni-data-select v-model="queryParams.<%= field.name %>" :localdata="dictType['<%= field.dict %>']" placeholder="<%= field.label %>"></zxz-uni-data-select>
              <%_ } _%>
            </u-form-item>
            <%_ } else if (field.display === 'radio') { _%>
            <%_ // 单选框 _%>
            <u-form-item label="<%= field.label %>" prop="<%= field.name %>">
              <u-radio-group v-model="queryParams.<%= field.name %>">
                <%_ if(field.dict) { _%>
                <u-radio label="请手动写入选项 或者 选择字典生成" name="1"></u-radio>
                <%_ } else { _%>
                <u-radio v-for="dict in dictType['<%= field.dict %>']" :key="dict.value" :label="dict.label" :name="dict.value"></u-radio>
                <%_ } _%>
              </u-radio-group>
            </u-form-item>
            <%_ } else if (field.display === 'date' && field.query !== 'BETWEEN') { _%>
            <%_ // 日期非范围 _%>
            <u-form-item label="<%= field.label %>" prop="<%= field.name %>">
              <uni-datetime-picker v-model="queryParams.<%= field.name %>" type="date" placeholder="<%= field.label %>" />
            </u-form-item>
            <%_ } else if (field.display === 'date' && field.query === 'BETWEEN') { _%>
            <%_ // 日期范围 _%>
            <u-form-item label="<%= field.label %>" prop="<%= field.name %>">
              <uni-datetime-picker v-model="queryParams.<%= field.name %>" type="daterange" placeholder="<%= field.label %>" />
            </u-form-item>
            <%_ } else if (field.display === 'datetime' && field.query !== 'BETWEEN') { _%>
            <%_ // 日期时间非范围 _%>
            <u-form-item label="<%= field.label %>" prop="<%= field.name %>">
              <uni-datetime-picker v-model="queryParams.<%= field.name %>" type="datetime" placeholder="<%= field.label %>" />
            </u-form-item>
            <%_ } else if (field.display === 'datetime' && field.query === 'BETWEEN') { _%>
            <%_ // 日期时间范围 _%>
            <u-form-item label="<%= field.label %>" prop="<%= field.name %>">
              <uni-datetime-picker v-model="queryParams.<%= field.name %>" type="datetimerange" placeholder="<%= field.label %>" />
            </u-form-item>
            <%_ } _%>
            <%_ } _%>
            <%_ } _%>
          </u-form>
        </view>
      </scroll-view>
      <view class="btn-box u-p-20">
        <u-button text="重置" shape="circle" @click="resetQuery"></u-button>
        <u-button type="primary" text="确定" shape="circle" @click="handleQuery"></u-button>
      </view>
    </u-popup>
    <%_ } _%>
    <!-- 添加编辑弹框 -->
    <AddOrEdit ref="addOrEditRef" @updateList="getList"></AddOrEdit>
    <%_ if(subTable) { _%>
    <!-- 子表 <%= _sub.comment %> 弹框 -->
    <view class="subTable">
      <u-popup :show="subTable.show" @close="handleSubTableClose" mode="center" round="10" :closeable="true" :closeOnClickOverlay="false">
        <view class="title"><%= _sub.comment %></view>
        <scroll-view class="popup-cont" scroll-y="true">
          <view class="u-p-20">
            <uni-table stripe :loading="subTable.loading" emptyText="暂无数据~">
              <uni-tr>
                <%_ // 循环字段 _%>
                <%_ for (const field of _sub.fieldList) { _%>
                <%_ // 单位处理 _%>
                <%_ const label = field.unit ? `${field.label}（${field.unit}）` : field.label _%>
                <%_ // 已配置列表显示 _%>
                <%_ if (field.list) { _%>
                <uni-th align="center"><%= label %></uni-th>
                <%_ } _%>
                <%_ } _%>
              </uni-tr>
              <uni-tr v-for="row in subTable.tableList" :key="row.id">
                <%_ // 循环字段 _%>
                <%_ for (const field of _sub.fieldList) { _%>
                <%_ // 单位处理 _%>
                <%_ const label = field.unit ? `${field.label}（${field.unit}）` : field.label _%>
                <%_ if (field.list) { _%>
                <%_ // 已配置列表显示 _%>
                <%_ if (field.display === 'input') { _%>
                <%_ // 文本框 _%>
                <uni-td align="center">{{ row.<%= field.name %> }}</uni-td>
                <%_ } else if (field.display === 'inputNumber') { _%>
                <%_ // 数字框 _%>
                <uni-td align="center">{{ row.<%= field.name %> }}</uni-td>
                <%_ } else if (field.display === 'textarea') { _%>
                <%_ // 文本域 _%>
                <uni-td align="center">{{ row.<%= field.name %> }}</uni-td>
                <%_ } else if (field.display === 'select') { _%>
                <%_ // 下拉框 _%>
                <%_ if (field.dict) { _%>
                <uni-td align="center">
                  <roc-dict-tag :options="dictType['<%= field.dict %>']" :value="row.<%= field.name %>"></roc-dict-tag>
                </uni-td>
                <%_ } else { _%>
                <uni-td align="center">{{ row.<%= field.name %> }}</uni-td>
                <%_ } _%>
                <%_ } else if (field.display === 'radio') { _%>
                <%_ // 单选框 _%>
                <%_ if (field.dict) { _%>
                <uni-td align="center">
                  <roc-dict-tag :options="dictType['<%= field.dict %>']" :value="row.<%= field.name %>"></roc-dict-tag>
                </uni-td>
                <%_ } else { _%>
                <uni-td align="center">{{ row.<%= field.name %> }}</uni-td>
                <%_ } _%>
                <%_ } else if (field.display === 'checkbox') { _%>
                <%_ // 复选框 _%>
                <%_ if (field.dict) { _%>
                <uni-td align="center">
                  <roc-dict-tag :options="dictType['<%= field.dict %>']" :value="row.<%= field.name %>"></roc-dict-tag>
                </uni-td>
                <%_ } else { _%>
                <uni-td align="center">{{ row.<%= field.name %> }}</uni-td>
                <%_ } _%>
                <%_ } else if (field.display === 'date') { _%>
                <%_ // 日期 _%>
                <uni-td align="center">{{ row.<%= field.name %> }}</uni-td>
                <%_ } else if (field.display === 'datetime') { _%>
                <%_ // 日期时间 _%>
                <uni-td align="center">{{ row.<%= field.name %> }}</uni-td>
                <%_ } else if (field.display === 'imageUpload') { _%>
                <%_ // 图片上传 _%>
                <uni-td align="center">
                  <u-album
                    style="display: inline-block; margin-top: 4px;"
                    :urls="row.<%= field.name %>"
                    :maxCount="1"
                    :singleSize="40"
                    :multipleSize="40"
                  ></u-album>
                </uni-td>
                <%_ } else if (field.display === 'fileUpload') { _%>
                <%_ // 文件上传 不显示 _%>
                <%_ } else if (field.display === 'editor') { _%>
                <%_ // 富文本 不显示 _%>
                <%_ } else { _%>
                <%_ // 其他 不显示 _%>
                <%_ } _%>
                <%_ } _%>
                <%_ } _%>
              </uni-tr>
            </uni-table>
          </view>
        </scroll-view>
      </u-popup>
    </view>
    <%_ } _%>
  </view>
</template>

<script>
import { cloneDeep } from 'lodash-es'
import { list<%= fn.snakeFormatHump(name, true) %>, del<%= fn.snakeFormatHump(name, true) %><% if(subTable) { %>, subDetail<%= fn.snakeFormatHump(name, true) %><% } %> } from '@/api/<%= fn.snakeFormatHump(name) %>.js'
import dictMinxin from '@/mixins/dict.js'
import AddOrEdit from './addOrEdit.vue'

export default {
  mixins: [dictMinxin],
  components: {
    AddOrEdit,
  },
  provide() {
    return {
      dictType: this.dictType,
    }
  },
  data() {
    return {
      pageTitle: '<%= comment %>',
      scrollTop: 0,
      queryParams: {
        page: 1,
        limit: 10,
        <%_ for (const field of fieldList) { _%>
        <%_ if (field.query) { _%>
        <%= field.name %>: null,
        <%_ } _%>
        <%_ } _%>
      },
      total: 0,
      loading: false,
      tableList: [],
      currentRow: {},
      // 模态框数据
      modal: {
        flag: '',
        show: false,
        title: '',
        content: '',
      },
      <%_ if(_hasQuery) { _%>
      searchShow: false,
      <%_ } _%>
      <%_ if(subTable) { _%>
      // 子表数据
      subTable: {
        show: false,
        loading: false,
        rowData: {},
        tableList: [],
      },
      <%_ } _%>
    }
  },
  onLoad(options) {
    if (options.pageTitle) this.pageTitle = options.pageTitle
    this.getDictData()
    this.getList()
  },
  methods: {
    /**
     * 字典数据获取
     */
    getDictData() {
      <%_ for (const dict in _uniDictList) { _%>
      this.getDict('<%= dict %>')
      <%_ } _%>
    },
    /**
     * 查询 <%= comment %> 列表
     */
    getList() {
      this.loading = true
      const _queryParams = cloneDeep(this.queryParams)
      list<%= fn.snakeFormatHump(name, true) %>(_queryParams).then(res => {
        // 数据转换
        this.tableList = res.data.rows.map(row => {
          <%_ // 数据处理 _%>
          <%_ for (const field of fieldList) { _%>
          <%_ // 字符串转换数组格式 _%>
          <%_ if (field.display === "imageUpload" || field.display === "fileUpload" || field.display === "checkbox") { _%>
          row.<%= field.name %> ? (row.<%= field.name %> = this.string2Array(row.<%= field.name %>)) : (row.<%= field.name %> = [])
          <%_ } _%>
          <%_ } _%>
          return row
        })
        this.total = res.data.total
        this.loading = false
      }).catch(() => {
        this.loading = false
      })
    },
    /**
     * 添加按钮操作
     */
    handleAdd() {
      this.$refs['addOrEditRef'].handleAdd()
    },
    /**
     * 编辑按钮操作
     * @param {Object} row
     */
    handleEdit(row) {
      const _row = cloneDeep(row)
      this.$refs['addOrEditRef'].handleEdit(_row)
    },
    /**
     * 删除按钮操作
     * @param {Object} row
     */
    handleDelete(row) {
      this.currentRow = cloneDeep(row)
      this.modal.flag = 'delete'
      this.modal.show = true
      this.modal.title = '系统提示'
      this.modal.content = '确认删除数据？'
    },
    /**
     * 模态框 点击了确认
     */
    handleModalConfirm() {
      if (this.modal.flag === 'delete') {
        // 删除操作
        const _ids = this.currentRow.<%= pkField.name %>
        del<%= fn.snakeFormatHump(name, true) %>({ ids: _ids }).then(() => {
          this.$u.toast('删除成功')
          this.modal.show = false
          this.getList()
        })
      }
    },
    /**
     * 搜索按钮操作
     */
    handleQuery() {
      this.queryParams.page = 1
      this.getList()
      this.searchShow = false
    },
    /**
     * 搜索重置按钮操作
     */
    resetQuery() {
      this.$refs['formRef'].resetFields()
      <%_ for(const field of fieldList) { _%>
      <%_ // 判断字段是否设置查询 _%>
      <%_ if (field.query) { _%>
      <%_ // 多选 数组类型 _%>
      <%_ if (field.display === "imageUpload" || field.display === "fileUpload" || field.display === "checkbox") { _%>
      this.queryParams.<%= field.name %> = []
      <%_ } else { _%>
      this.queryParams.<%= field.name %> = null
      <%_ } _%>
      <%_ } _%>
      <%_ } _%>
      this.handleQuery()
    },
    <%_ if(subTable) { _%>
    /**
     * 明细按钮操作
     * @param {Object} row
     */
    handleDetail(row) {
      this.subTable.rowData = row
      this.getSubTableList(row.id)
      this.handleSubTableOpen()
    },
    /**
     * 打开明细弹窗
     */
     handleSubTableOpen() {
      this.show = true
    },
    /**
     * 关闭明细弹窗
     */
     handleSubTableClose() {
      this.show = false
    },
    /**
     * 获取子表数据
     * @param {Number} id
     */
     getSubTableList(id) {
      this.subTable.loading = true
      subDetail<%= fn.snakeFormatHump(name, true) %>({ id }).then(res => {
        // 数据转换
        this.subTable.tableList = res.data.map(row => {
          <%_ // 数据处理 _%>
          <%_ for (const field of _sub.fieldList) { _%>
          <%_ // 字符串转换数组格式 _%>
          <%_ if (field.display === "imageUpload" || field.display === "fileUpload" || field.display === "checkbox") { _%>
          row.<%= field.name %> ? (row.<%= field.name %> = this.string2Array(row.<%= field.name %>)) : (row.<%= field.name %> = [])
          <%_ } _%>
          <%_ } _%>
          return row
        })
        this.subTable.loading = false
      }).catch(() => {
        this.subTable.loading = false
      })
    },
    <%_ } _%>
  },
  onPageScroll(e) {
    this.scrollTop = e.scrollTop
  },
  onPullDownRefresh() {
    this.queryParams.page = 1
    this.getDictData()
    this.getList()
    uni.stopPullDownRefresh()
  },
}
</script>

<style lang="scss" scoped>
// 查询弹窗
.search-popup {
  .title {
    text-align: center;
    padding: 14px 0 5px 0;
    font-size: 16px;
  }
  .popup-cont {
    height: calc(80vh - 120px);
  }
  .btn-box {
    display: flex;
    .u-button {
      width: 46%;
    }
  }
}

// 表格后按钮
.table-btn {
  text + text {
    margin-left: 10px;
  }
}

// 列表形式
.roc-list {
  $titleFontSize: 16px;
  $contFontSize: 14px;
  .list-item {
    margin-top: 20px;
    border: 1px solid #ebeef5;
    border-radius: 5px;
    background-color: #fff;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    &:nth-child(1) {
      margin-top: 0;
    }
    .top,
    .center,
    .bottom {
      display: flex;
      justify-content: space-between;
    }
    .top {
      padding-bottom: 10px;
      .area1 {
        font-size: $titleFontSize;
      }
      .area2 {
        margin-left: 5px;
      }
    }
    .center {
      flex-wrap: wrap;
      padding-top: 10px;
      padding-bottom: 10px;
      border-top: 1px solid rgba(0, 0, 0, 0.06);
      .area3 {
        display: flex;
        width: 50%;
        color: #333;
        line-height: 2;
        font-size: $contFontSize;
      }
    }
    .bottom {
      flex-wrap: wrap;
      border-top: 1px solid rgba(0, 0, 0, 0.06);
      padding: 10px 0;
      .area4 {
        width: 100%;
        color: #333;
        font-size: $contFontSize;
        margin-bottom: 5px;
      }
    }
    .btn-box {
      display: flex;
      justify-content: flex-end;
      padding-top: 10px;
      border-top: 1px solid rgba(0, 0, 0, 0.1);
      .u-button {
        width: 50px;
        margin: 0;
        & + .u-button {
          margin-left: 8px;
        }
      }
    }
  }
}
.subTable {
  .title {
    text-align: center;
    padding: 14px 0 5px 0;
    font-size: 16px;
  }
  .popup-cont {
    height: calc(90vh - 120px - 88px);
    width: 90vw;
  }
}
</style>
